﻿<!--#include file="const.asp"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
if sid="Null" then
	Response.Redirect "login.asp"
	Response.end
end if
IF  Request.QueryString("Action")="login" Then
	call login
else
	call index
end if
end Function



Function index
	dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
	dim  rs,sql,Runtxt,pid

	Runtxt=qingtian.RunStr

	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "SELECT top 1 pid from qingtian_link_class order by pid desc"
	Rs.Open Sql,conn,1,1
	if not (rs.bof and rs.eof) then
		pid=rs("pid")+1
	else
		pid=1
	end if
	Rs.close
	set rs=nothing	


%>
	<card title="添加友链分类"><p align="left">

	分类名称：<br/>
	<input emptyok="true"  name="name<%=Runtxt%>"  value="" type="text"/><br/>
	排序：(小排前)<br/>
	<input emptyok="true"  name="pid<%=Runtxt%>" format="*N" value="<%=pid%>" type="text"/><br/>
	换行：
   	<select name="br<%=Runtxt%>" value="0">
	<option value="0">不换行</option>
	<option value="1">换行</option>
	</select><br/>

	<anchor>确定提交
    	<go href="addlinkclass.asp?Action=login&amp;page=<%=page%>&amp;sid=<%=sid%>" method='post'>
        <postfield name="name" value="$(name<%=Runtxt%>)"/>
        <postfield name="br" value="$(br<%=Runtxt%>)"/>
        <postfield name="pid" value="$(pid<%=Runtxt%>)"/>
    	</go>
	</anchor><br/>

-------------<br/>
<a href='linkclass.asp?page=<%=page%>&amp;sid=<%=sid%>'>返回友链管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
End Function


Function login
	dim page
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1

		dim rs,sql,errs,classid,fleg,Path,txtid
    		classid = Request("classid")
    		If classid = "" Then classid = 0
   		If Not IsNumeric(classid) Then classid = 0
    		classid = CLng(classid)
    		If classid < 0 Then classid = 0

		dim name,br,pid
        name=Request.form("name")
        br=Request.form("br")
 	pid=TRim(Request.Form("pid"))

		errs=""

	if name=""  then errmsg=errmsg&"名称不能为空<br/>"
	if br=""  then errmsg=errmsg&"换行不能为空<br/>"
	if not isnumeric(br) then errmsg=errmsg&"换行必须为数字<br/>"
	if pid=""  then errmsg=errmsg&"排序不能为空<br/>"


	%>
	<card id="login" title="添加友链分类" ontimer="linkclass.asp?page=<%=page%>&amp;sid=<%=sid%>"><timer value="20"/>
		<p align="left">
	<%
	IF len(errs)=0 then

		set rs=Server.CreateObject("ADODB.Recordset")
		Sql = "select *  FROM qingtian_link_class"
		rs.open sql,conn,1,3
		rs.addnew()
			rs("name")=name
			rs("pid")=pid
			rs("br")=br
		rs.update()
		rs.Close
		Set rs = Nothing
		%>添加友链分类成功!<br/><%

	else%>
		<%=errs%>
		<a href="addlinkclass.asp?page=<%=page%>&amp;sid=<%=sid%>">返回修改</a><br/>
<%	end if
%>
<a href='linkclass.asp?page=<%=page%>&amp;sid=<%=sid%>'>返回友链管理</a><br/>
<a href='index.asp?sid=<%=sid%>'>后台管理首页</a><br/>
<%
end Function 


%>
